using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
using System.Collections;
using System.Configuration;
namespace DataAccess
{
    public class clsSqlDataProvider
    {
        //Fields.
        private String conString;
        private SqlConnection con;


        //Constructors.
        public clsSqlDataProvider()
        {
            this.conString = "Data Source=(local);Initial Catalog=QLTV; Integrated Security=true";
        }

        public clsSqlDataProvider(String conString)
        {
            this.conString = conString;
        }

        //Properties.
        public String ConnectionString
        {
            set { this.conString = value; }
        }

        public SqlConnection SQLConnection
        {
            set { this.con = value; }
            get { return this.con; }
        }

        //Methods.
        public void KetNoi()
        {
            try
            {
                this.con = new SqlConnection(); 
                this.con.ConnectionString = this.conString;
                this.con.Open();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void DongKetNoi()
        {
            try
            {
                this.con.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        
    }
}
